home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / forms / frmwiz / dataspec.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-01-14  |  10.3 KB  |  342 lines

  1. VERSION 2.00
  2. Begin Form DataSpec 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "Form Wizard - Data Control Specifications"
  6.    ClientHeight    =   3075
  7.    ClientLeft      =   3225
  8.    ClientTop       =   1635
  9.    ClientWidth     =   6090
  10.    ControlBox      =   0   'False
  11.    Height          =   3480
  12.    HelpContextID   =   18
  13.    Icon            =   DATASPEC.FRX:0000
  14.    Left            =   3165
  15.    LinkTopic       =   "Form1"
  16.    MaxButton       =   0   'False
  17.    ScaleHeight     =   3075
  18.    ScaleWidth      =   6090
  19.    Top             =   1290
  20.    Width           =   6210
  21.    Begin SSCommand BtnHelp 
  22.       Caption         =   "&Help"
  23.       Font3D          =   2  'Raised w/heavy shading
  24.       Height          =   615
  25.       Left            =   4320
  26.       Picture         =   DATASPEC.FRX:0302
  27.       TabIndex        =   14
  28.       Top             =   1980
  29.       Width           =   915
  30.    End
  31.    Begin CommonDialog CMDialog1 
  32.       DialogTitle     =   "Select Database For Data Control"
  33.       Filter          =   "Access Databases|*.mdb"
  34.       Left            =   120
  35.       Top             =   2100
  36.    End
  37.    Begin ComboBox LstRecSrce 
  38.       BackColor       =   &H00C0C0C0&
  39.       Height          =   300
  40.       Left            =   1560
  41.       Sorted          =   -1  'True
  42.       Style           =   2  'Dropdown List
  43.       TabIndex        =   4
  44.       Tag             =   "Select or enter record source for the data control"
  45.       Top             =   1560
  46.       Width           =   4395
  47.    End
  48.    Begin SSCommand BtnFindDB 
  49.       AutoSize        =   2  'Adjust Button Size To Picture
  50.       Font3D          =   2  'Raised w/heavy shading
  51.       Height          =   600
  52.       Left            =   5340
  53.       Picture         =   DATASPEC.FRX:0604
  54.       TabIndex        =   3
  55.       Tag             =   "Press to find the database"
  56.       Top             =   840
  57.       Width           =   600
  58.    End
  59.    Begin TextBox TxtDBName 
  60.       BackColor       =   &H00C0C0C0&
  61.       Height          =   375
  62.       Left            =   1560
  63.       TabIndex        =   2
  64.       Tag             =   "Name of the database for the data control"
  65.       Text            =   "Database Name"
  66.       Top             =   1080
  67.       Width           =   3675
  68.    End
  69.    Begin TextBox TxtName 
  70.       BackColor       =   &H00C0C0C0&
  71.       Height          =   375
  72.       Left            =   1560
  73.       TabIndex        =   0
  74.       Tag             =   "Name for the data control"
  75.       Text            =   "DataName"
  76.       Top             =   120
  77.       Width           =   3675
  78.    End
  79.    Begin TextBox TxtCaption 
  80.       BackColor       =   &H00C0C0C0&
  81.       Height          =   375
  82.       Left            =   1560
  83.       TabIndex        =   1
  84.       Tag             =   "Caption for the data control"
  85.       Text            =   "Data Caption"
  86.       Top             =   600
  87.       Width           =   3675
  88.    End
  89.    Begin SSCommand BtnPrev 
  90.       AutoSize        =   2  'Adjust Button Size To Picture
  91.       Caption         =   "&Previous"
  92.       Font3D          =   2  'Raised w/heavy shading
  93.       Height          =   615
  94.       Left            =   720
  95.       Picture         =   DATASPEC.FRX:0906
  96.       TabIndex        =   5
  97.       Tag             =   "Return to previous step"
  98.       Top             =   1980
  99.       Width           =   915
  100.    End
  101.    Begin SSCommand BtnNext 
  102.       AutoSize        =   2  'Adjust Button Size To Picture
  103.       Caption         =   "&Next"
  104.       Font3D          =   2  'Raised w/heavy shading
  105.       Height          =   615
  106.       Left            =   1620
  107.       Picture         =   DATASPEC.FRX:0C08
  108.       TabIndex        =   6
  109.       Tag             =   "Proceed to the next step"
  110.       Top             =   1980
  111.       Width           =   915
  112.    End
  113.    Begin SSCommand BtnCancel 
  114.       AutoSize        =   2  'Adjust Button Size To Picture
  115.       Caption         =   "&Cancel"
  116.       Font3D          =   2  'Raised w/heavy shading
  117.       Height          =   615
  118.       Left            =   2520
  119.       Picture         =   DATASPEC.FRX:0F0A
  120.       TabIndex        =   7
  121.       Tag             =   "Cancel building the form"
  122.       Top             =   1980
  123.       Width           =   915
  124.    End
  125.    Begin SSCommand BtnFinish 
  126.       AutoSize        =   2  'Adjust Button Size To Picture
  127.       Caption         =   "&Finish"
  128.       Enabled         =   0   'False
  129.       Font3D          =   2  'Raised w/heavy shading
  130.       Height          =   615
  131.       Left            =   3420
  132.       Picture         =   DATASPEC.FRX:120C
  133.       TabIndex        =   8
  134.       Top             =   1980
  135.       Width           =   915
  136.    End
  137.    Begin SSPanel cMsg 
  138.       Align           =   2  'Align Bottom
  139.       Alignment       =   1  'Left Justify - MIDDLE
  140.       BevelInner      =   1  'Inset
  141.       BorderWidth     =   2
  142.       Height          =   375
  143.       Left            =   0
  144.       TabIndex        =   9
  145.       Top             =   2700
  146.       Width           =   6090
  147.    End
  148.    Begin Label Label1 
  149.       Alignment       =   1  'Right Justify
  150.       AutoSize        =   -1  'True
  151.       BackColor       =   &H00C0C0C0&
  152.       Caption         =   "Record Source"
  153.       ForeColor       =   &H00FF0000&
  154.       Height          =   195
  155.       Index           =   3
  156.       Left            =   195
  157.       TabIndex        =   13
  158.       Top             =   1620
  159.       Width           =   1290
  160.    End
  161.    Begin Label Label1 
  162.       Alignment       =   1  'Right Justify
  163.       AutoSize        =   -1  'True
  164.       BackColor       =   &H00C0C0C0&
  165.       Caption         =   "Database Name"
  166.       ForeColor       =   &H00FF0000&
  167.       Height          =   195
  168.       Index           =   2
  169.       Left            =   120
  170.       TabIndex        =   12
  171.       Top             =   1200
  172.       Width           =   1365
  173.    End
  174.    Begin Label Label1 
  175.       Alignment       =   1  'Right Justify
  176.       AutoSize        =   -1  'True
  177.       BackColor       =   &H00C0C0C0&
  178.       Caption         =   "Name"
  179.       ForeColor       =   &H00FF0000&
  180.       Height          =   195
  181.       Index           =   1
  182.       Left            =   960
  183.       TabIndex        =   11
  184.       Top             =   180
  185.       Width           =   495
  186.    End
  187.    Begin Label Label1 
  188.       Alignment       =   1  'Right Justify
  189.       AutoSize        =   -1  'True
  190.       BackColor       =   &H00C0C0C0&
  191.       Caption         =   "Caption"
  192.       ForeColor       =   &H00FF0000&
  193.       Height          =   195
  194.       Index           =   0
  195.       Left            =   780
  196.       TabIndex        =   10
  197.       Top             =   660
  198.       Width           =   660
  199.    End
  200. Option Explicit
  201. Sub BtnCancel_Click ()
  202.     EndItNow
  203. End Sub
  204. Sub BtnCancel_GotFocus ()
  205.     cMsg.Caption = BtnCancel.Tag
  206. End Sub
  207. Sub BtnCancel_LostFocus ()
  208.     cMsg.Caption = ""
  209. End Sub
  210. Sub BtnFindDB_Click ()
  211.     CMDialog1.Flags = OFN_FILEMUSTEXIST
  212.     CMDialog1.Action = 1
  213.     If CMDialog1.Filename <> "" Then
  214.         TxtDBName = CMDialog1.Filename
  215.         GetTableNames
  216.     End If
  217. End Sub
  218. Sub BtnFindDB_GotFocus ()
  219.     cMsg.Caption = BtnFindDB.Tag
  220. End Sub
  221. Sub BtnFindDB_LostFocus ()
  222.     cMsg.Caption = ""
  223. End Sub
  224. Sub BtnHelp_Click ()
  225.     SendKeys "{F1}"
  226. End Sub
  227. Sub BtnNext_Click ()
  228.     FieldFrm.Show MODELESS
  229.     DataSpec.Hide
  230. End Sub
  231. Sub BtnNext_GotFocus ()
  232.     cMsg.Caption = BtnNext.Tag
  233. End Sub
  234. Sub BtnNext_LostFocus ()
  235.     cMsg.Caption = ""
  236. End Sub
  237. Sub BtnPrev_Click ()
  238.     CaptnFrm.Show MODELESS
  239.     DataSpec.Hide
  240. End Sub
  241. Sub BtnPrev_GotFocus ()
  242.     cMsg.Caption = BtnPrev.Tag
  243. End Sub
  244. Sub BtnPrev_LostFocus ()
  245.     cMsg.Caption = ""
  246. End Sub
  247. Sub FldGotFocus (PControl As Control)
  248.     PControl.BackColor = BLUE
  249.     PControl.ForeColor = WHITE
  250.     PControl.SelStart = 0
  251.     PControl.SelLength = 1000
  252.     cMsg.Caption = PControl.Tag
  253. End Sub
  254. Sub FldLostFocus (PControl As Control)
  255.     PControl.BackColor = RB_GRAY
  256.     PControl.ForeColor = BLACK
  257.     cMsg.Caption = ""
  258. End Sub
  259. Sub Form_Paint ()
  260.     Form3d Me
  261. End Sub
  262. Sub GetTableNames ()
  263.     ' Get names of tables in selected database
  264.     Dim sstables As snapshot, msg As String
  265.     On Error GoTo GetTablesErr
  266.     mousepointer = HOURGLASS
  267.     If TxtDBName.Text = "" Then Exit Sub
  268.     On Error GoTo OpenDBErr
  269.     If Dir$(TxtDBName.Text) = "" Then
  270.         Beep
  271.         MsgBox "The database name you have specified does not exist!  Use the file drawer button to locate a database.", 0 + 48 + 0 + 0, "Database Selection Error"
  272.         TxtDBName.SetFocus
  273.         mousepointer = DEFAULT
  274.         Exit Sub
  275.     End If
  276.     LstRecSrce.Clear
  277.     Set db = OpenDatabase(TxtDBName.Text)
  278.     On Error GoTo GetTablesErr
  279.     Set sstables = db.ListTables()
  280.     Do While Not sstables.EOF
  281.         If sstables!Attributes And DB_SYSTEMOBJECT Then
  282.         Else
  283.             LstRecSrce.AddItem sstables!Name
  284.         End If
  285.         sstables.MoveNext
  286.     Loop
  287.     sstables.Close
  288.     LstRecSrce.ListIndex = 0
  289.     mousepointer = DEFAULT
  290.     Exit Sub
  291. OpenDBErr:
  292.     Beep
  293.     mousepointer = DEFAULT
  294.     msg = "A " & Error & " error has occurred opening the database!  Please correct and retry the function"
  295.     MsgBox msg, 0 + 48 + 0 + 0, "Database Specification Error"
  296.     TxtDBName.SetFocus
  297.     On Error GoTo GetTablesErr
  298.     mousepointer = DEFAULT
  299.     Exit Sub
  300. GetTablesErr:
  301.     mousepointer = DEFAULT
  302.     erraction = RB_ErrorHandler("DataSpec", "GetTableNames")
  303.     Select Case erraction
  304.     Case 1
  305.         Resume 0      ' Retry option selected
  306.     Case 2
  307.         Resume Next   ' Ignore option selected
  308.     End Select
  309. End Sub
  310. Sub LstRecSrce_Click ()
  311.     NewRecordSource = True
  312. End Sub
  313. Sub LstRecSrce_GotFocus ()
  314.     LstRecSrce.BackColor = BLUE
  315.     LstRecSrce.ForeColor = WHITE
  316.     cMsg.Caption = LstRecSrce.Tag
  317. End Sub
  318. Sub LstRecSrce_LostFocus ()
  319.     FldLostFocus LstRecSrce
  320. End Sub
  321. Sub TxtCaption_GotFocus ()
  322.     FldGotFocus TxtCaption
  323. End Sub
  324. Sub TxtCaption_LostFocus ()
  325.     FldLostFocus TxtCaption
  326. End Sub
  327. Sub TxtDBName_GotFocus ()
  328.     FldGotFocus TxtDBName
  329. End Sub
  330. Sub TxtDBName_LostFocus ()
  331.     FldLostFocus TxtDBName
  332.     If TxtDBName.DataChanged Then
  333.         GetTableNames
  334.     End If
  335. End Sub
  336. Sub TxtName_GotFocus ()
  337.     FldGotFocus TxtName
  338. End Sub
  339. Sub TxtName_LostFocus ()
  340.     FldLostFocus TxtName
  341. End Sub
  342.